<template>
	<view>
		<view class="input">
			<input v-model="userid" type="text" placeholder="输入USERID" />
		</view>
		<view class="btn" @click="handleAdd">
			添加好友
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userid: ""
			}
		},
		methods: {
			handleAdd() {
				uni.$TUIKit.addFriend({
					to: this.userid,
					source: 'AddSource_Type_Web',
					type: uni.$TUIKitTypes.SNS_ADD_TYPE_SINGLE
				}).then(function(imResponse) {
					console.log(imResponse,'--------');
					if(imResponse.code == 0){
						uni.showToast({
							icon:'none',
							title:'好友已添加'
						})
					}
				}).catch(function(imError) {
					console.log('removeFromFriendList error:', imError);
				});
			}
		}
	}
</script>

<style lang="scss">
	.input {
		width: 710rpx;
		border: 1px solid #eeeeee;
		height: 80rpx;
		margin: 30rpx auto;
		font-size: 30rpx;
		border-radius: 10rpx;
		line-height: 80rpx;

		input {
			line-height: 80rpx;
			height: 80rpx;
			padding-left: 15rpx;
		}
	}

	.btn {
		width: 710rpx;
		margin: 30rpx auto;
		text-align: center;
		font-size: 30rpx;
	}
</style>